package com.zengqingfa.demo;

import com.zengqingfa.demo.event.MyEvent;
import com.zengqingfa.demo.listener.MyListener1;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@SpringBootApplication
@MapperScan("com.zengqingfa.demo.mapper")
@ServletComponentScan
public class SpringbootMybatisApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootMybatisApplication.class, args);
//        //装载监听
//        context.addApplicationListener(new MyListener1());
//        //发布事件
//        context.publishEvent(new MyEvent("发布事件"));
//        AnnotationConfigApplicationContext applicationContext= new AnnotationConfigApplicationContext(SpringbootMybatisApplication.class);
        Object aService = context.getBean("aService");
        System.out.println(aService);
    }

}



